Skip to content

feat: Phase 5 — GitHub Actions for lint + profile re-run#11

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/ci-actions
May 16, 2026
Merged

feat: Phase 5 — GitHub Actions for lint + profile re-run#11
Jammy2211 merged 1 commit into
mainfrom
feature/ci-actions

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

Phase 5 (final) of the autolens_profiling z_feature roadmap — wires up CI for the new repo and threads AUTOLENS_PROFILING_SMOKE=1 through every profile script so the lint workflow's smoke step is cheap.

Closes #7.

What lands in this PR

Two GitHub Actions workflows

File Trigger Job
.github/workflows/lint.yml pull_request, push: main ruff lint + format, dashboard idempotence (build_readme.py --check), lychee link-rot, smoke 3 scripts
.github/workflows/profile.yml workflow_dispatch (with sections filter), release: published Run profile scripts, regenerate results/, refresh dashboard, commit back as github-actions[bot] with [skip ci]

Both target ubuntu-latest (CPU-only). The smoke step short-circuits each profile script via AUTOLENS_PROFILING_SMOKE=1, so no real artifacts are produced in the lint workflow.

ruff.toml at repo root

This repo isn't a Python package, so a standalone ruff.toml (a supported configuration location) is cleaner than fabricating a pyproject.toml. Conservative rule selection: E/F/W/I/UP/B; E501/E402/F401/B008 ignored for scientific code patterns.

AUTOLENS_PROFILING_SMOKE=1 short-circuit threaded into 17 scripts

Inserted via an AST-driven helper at the first non-import, non-docstring top-level statement of each script:

import os as _smoke_os
import sys as _smoke_sys
if _smoke_os.environ.get(\"AUTOLENS_PROFILING_SMOKE\") == \"1\":
    print(f\"[smoke] {__file__}: imports + module setup OK; exiting.\")
    _smoke_sys.exit(0)

Coverage: 17 scripts across likelihood/{imaging,interferometer,point_source,datacube}/*.py, simulators/*.py, searches/nautilus/*.py. Idempotent — re-running the helper detects existing instances.

Workflows README

.github/workflows/README.md documents both workflows, the manual-trigger procedure, and captures all design decisions inline for future maintainers.

Design decisions resolved

  • Runners: CPU-only on github-hosted ubuntu-latest. Self-hosted GPU runners deferred (additive on this workflow shape — see top-level README "Future enhancements" for the matching dashboard-side column extension).
  • Cadence: workflow_dispatch + release: published. No weekly cron — releases are the natural cross-version-comparison anchor.
  • Bot identity: github-actions[bot] with [skip ci] subject line. Avoids lint workflow re-trigger on the auto-generated commit.
  • Failure handling: continue-on-error: true per section. A single regression emits ::warning:: and leaves the dashboard cell as ERR rather than blocking the refresh for the other 16+ scripts.
  • Smoke env var: AUTOLENS_PROFILING_SMOKE=1, per the Phase 5 prompt.
  • ruff config location: ruff.toml at root (no pyproject.toml because this isn't a Python package).
  • Skipping simulators/point_source.py in the profile loop: its default dataset_name=\"simple\" overwrites Phase 1's tracked likelihood JSONs. Manual runs with a non-conflicting dataset_name remain supported.

Test plan

  • yaml.safe_load PASSES on both .github/workflows/*.yml.
  • py_compile PASSES on all 17 SMOKE-instrumented scripts.
  • AUTOLENS_PROFILING_SMOKE=1 python likelihood/imaging/mge.py exits 0 in <1s with the expected smoke-OK line.
  • Same for simulators/imaging.py and searches/nautilus/simple.py.
  • python scripts/build_readme.py --check exits 0 after SMOKE insertions — Phase 4 idempotence is preserved.
  • First real CI run will be against this PR itself — local YAML parsing is necessary but not sufficient. Any GitHub Actions runtime issues get follow-up PRs.

Refs

🤖 Generated with Claude Code

…hase 5)

Phase 5 (final) of the autolens_profiling z_feature roadmap. Wires up
two GitHub Actions workflows + threads AUTOLENS_PROFILING_SMOKE=1 into
every profile script so the lint workflow's smoke step short-circuits
cheaply.

What lands in this PR
---------------------

1. ruff.toml — repo-root ruff config (the repo isn't a Python package
   so there's no pyproject.toml). Conservative rule selection:
   E/F/W/I/UP/B with E501/E402/F401/B008 ignored for scientific code.

2. .github/workflows/lint.yml — Workflow 1, PR + push-to-main gate.
   Target wall time <5 min on CPU-only ubuntu-latest. Steps:
   - ruff check . + ruff format --check .
   - python scripts/build_readme.py --check (dashboard idempotence)
   - lychee markdown link-rot across every README.md
   - Smoke: one script per section with AUTOLENS_PROFILING_SMOKE=1
     (catches import-graph breakage without running the full profile)

3. .github/workflows/profile.yml — Workflow 2, manual + on release.
   - workflow_dispatch with optional `sections` input
   - release: published trigger
   - Runs every script under likelihood/, simulators/, searches/nautilus/
     with continue-on-error per section (single regression doesn't block
     the dashboard refresh for the other 16)
   - Skips simulators/point_source.py in the loop (its default
     dataset_name="simple" overwrites Phase 1's tracked likelihood JSONs)
   - Runs scripts/build_readme.py to refresh dashboard tables
   - Commits diff back to main as github-actions[bot] with [skip ci]

4. .github/workflows/README.md — documents both workflows + design
   decisions captured for future maintainers.

5. AUTOLENS_PROFILING_SMOKE=1 short-circuit threaded into 17 scripts:
   - likelihood/imaging/{mge,pixelization,delaunay}.py
   - likelihood/interferometer/{mge,pixelization,delaunay}.py
   - likelihood/point_source/{image_plane,source_plane}.py
   - likelihood/datacube/delaunay.py
   - simulators/{imaging,interferometer,point_source,cluster,group,multi}.py
   - searches/nautilus/{simple,jax}.py
   Inserted via AST-driven helper at the first non-import top-level
   statement of each script (after the module docstring + initial
   imports, before any module-level execution). Verified end-to-end:
   AUTOLENS_PROFILING_SMOKE=1 python <script> exits in <1s for all 3
   representative scripts smoked locally.

Design decisions resolved
-------------------------

- Runners: CPU-only on github-hosted ubuntu-latest. Self-hosted GPU
  runners can be added later as a separate job without restructuring.
- Cadence: workflow_dispatch + release-triggered only. No weekly cron.
- Bot identity: github-actions[bot] with [skip ci] subject line.
- Failure handling: continue-on-error per script with ::warning::
  annotation; dashboard cell shows ERR rather than blocking refresh.
- Smoke env var name: AUTOLENS_PROFILING_SMOKE=1 (proposed in the
  Phase 5 prompt, kept as-is).
- ruff config location: ruff.toml at repo root rather than
  pyproject.toml — this isn't a Python package, ruff supports the
  standalone config file natively.

Test plan
---------

- [x] yaml.safe_load PASSES on both lint.yml and profile.yml.
- [x] py_compile PASSES on all 17 SMOKE-instrumented scripts.
- [x] AUTOLENS_PROFILING_SMOKE=1 python likelihood/imaging/mge.py exits
      0 in <1s with "[smoke] ... imports + module setup OK; exiting."
- [x] Same for simulators/imaging.py and searches/nautilus/simple.py.
- [x] scripts/build_readme.py --check exits 0 after SMOKE insertions
      (dashboard idempotence preserved).
- [ ] First lint workflow run will be the real check — local YAML
      parses but actual GitHub Actions semantics validate on the
      runner. Any failures from there get follow-up PRs against this
      workflow file.

Closes #7.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jammy2211 Jammy2211 merged commit e18685b into main May 16, 2026
@Jammy2211 Jammy2211 deleted the feature/ci-actions branch May 16, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Phase 5 — GitHub Actions for lint + profile re-run

1 participant